#pragma once
#include <dokan/dokan.h>

#include "BackupFSFileNodes.h"
#include "BackupFS.h"

namespace BackupFS
{
	extern DOKAN_OPERATIONS BackupFSOperations;
#define GET_FS_INSTANCE reinterpret_cast<BackupVFS *>(dokanfileinfo->DokanOptions->GlobalContext)
#define GET_FS_NODES reinterpret_cast<BackupVFS *>(dokanfileinfo->DokanOptions->GlobalContext)->FsFileNodes.get()
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_CreateFile(LPCWSTR filename, PDOKAN_IO_SECURITY_CONTEXT security_context,
			ACCESS_MASK desiredaccess, ULONG fileattributes,
			ULONG /*shareaccess*/, ULONG createdisposition,
			ULONG createoptions, PDOKAN_FILE_INFO dokanfileinfo);
	static void DOKAN_CALLBACK BackupFS_CleanUp(LPCWSTR filename,
		PDOKAN_FILE_INFO dokanfileinfo);
	static void DOKAN_CALLBACK BackupFS_CloseFile(LPCWSTR filename,
		PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_ReadFile(LPCWSTR filename, LPVOID buffer,
		DWORD bufferlength,
		LPDWORD readlength,
		LONGLONG offset,
		PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_WriteFile(LPCWSTR filename, LPCVOID buffer,
		DWORD number_of_bytes_to_write,
		LPDWORD number_of_bytes_written,
		LONGLONG offset,
		PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_FlushFileBuffers(LPCWSTR filename, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_GetFileInformation(LPCWSTR filename, LPBY_HANDLE_FILE_INFORMATION buffer,
			PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_FindFiles(LPCWSTR filename,
		PFillFindData fill_finddata,
		PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_SetFileAttributes(
		LPCWSTR filename, DWORD fileattributes, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_SetFileTime(LPCWSTR filename, CONST FILETIME* creationtime,
			CONST FILETIME* lastaccesstime, CONST FILETIME* lastwritetime,
			PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_DeleteFile(LPCWSTR filename, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_DeleteDirectory(LPCWSTR filename, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_MoveFile(LPCWSTR filename,
		LPCWSTR new_filename,
		BOOL replace_if_existing,
		PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_SetEndOfFile(
		LPCWSTR filename, LONGLONG ByteOffset, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_SetAllocationSize(
		LPCWSTR filename, LONGLONG alloc_size, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_LockFile(LPCWSTR filename,
		LONGLONG byte_offset,
		LONGLONG length,
		PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_UnLockFile(LPCWSTR filename, LONGLONG byte_offset, LONGLONG length,
			PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_GetDiskFreeSpace(
		PULONGLONG free_bytes_available, PULONGLONG total_number_of_bytes,
		PULONGLONG total_number_of_free_bytes, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_GetVolumeInformation(
		LPWSTR volumename_buffer, DWORD volumename_size,
		LPDWORD volume_serialnumber, LPDWORD maximum_component_length,
		LPDWORD filesystem_flags, LPWSTR filesystem_name_buffer,
		DWORD filesystem_name_size, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK
		BackupFS_Mounted(LPCWSTR MountPoint, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_GetFileSecurity(
		LPCWSTR filename, PSECURITY_INFORMATION security_information,
		PSECURITY_DESCRIPTOR security_descriptor, ULONG bufferlength,
		PULONG length_needed, PDOKAN_FILE_INFO dokanfileinfo);
	static NTSTATUS DOKAN_CALLBACK BackupFS_SetFileSecurity(
		LPCWSTR filename, PSECURITY_INFORMATION security_information,
		PSECURITY_DESCRIPTOR security_descriptor, ULONG /*bufferlength*/,
		PDOKAN_FILE_INFO dokanfileinfo);



















}  // namespace BackupFS
